import { TCareer } from "../../../Message/Db/Tables/TCareer";
import { StringHelper } from "../../../com/gengine/utils/StringHelper";
import { ConfigManager } from "../../../com/gengine/resource/ConfigManager";
type int = number;
//class CareerConfig
    
    export  class CareerConfig
    {
        constructor()
        {
            
            this._map = new Map<any, any> /* flash.utils.Dictionary */();
            if (CareerConfig._instance != null) 
            {
                throw new Error(" ResConfig 单例 ");
            }
            this.init();
            return;
        }

        /* internal  */write(arg1: Object): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            var loc4=arg1;
            for(loc2 of loc4) 
            {
                loc1 = new TCareer();
                loc1.code = loc2.code;
                loc1.name = StringHelper.getString(loc2.name);
                loc1.attackType = loc2.attackType;
                loc1.powerPhysicalAttack = loc2.powerPhysicalAttack;
                loc1.powerPhysicalDefense = loc2.powerPhysicalDefense;
                loc1.agilePhysicalAttack = loc2.agilePhysicalAttack;
                loc1.agilePhysicalCrit = loc2.agilePhysicalCrit;
                loc1.agileJouk = loc2.agileJouk;
                loc1.brainsJouk = loc2.brainsJouk;
                loc1.habitusLife = loc2.habitusLife;
                loc1.habitusPhysicalDefense = loc2.habitusPhysicalDefense;
                loc1.habitusMagicDefense = loc2.habitusMagicDefense;
                loc1.brainsMagic = loc2.brainsMagic;
                loc1.brainsMagicCrit = loc2.brainsMagicCrit;
                loc1.brainsMagicAttack = loc2.brainsMagicAttack;
                loc1.spiritualMagicAttack = loc2.spiritualMagicAttack;
                loc1.spiritualMagicDefense = loc2.spiritualMagicDefense;
                loc1.initPower = loc2.initPower;
                loc1.initAgile = loc2.initAgile;
                loc1.initHabitus = loc2.initHabitus;
                loc1.initBrains = loc2.initBrains;
                loc1.initSpiritual = loc2.initSpiritual;
                loc1.initBagCapacity = loc2.initBagCapacity;
                loc1.initWarehouseCapacity = loc2.initWarehouseCapacity;
                loc1.initGrowth = loc2.initGrowth;
                loc1.initLife = loc2.initLife;
                loc1.initMana = loc2.initMana;
                loc1.initLevel = loc2.initLevel;
                loc1.speed = loc2.speed;
                loc1.attackSpeed = loc2.attackSpeed;
                loc1.attackDistance = loc2.attackDistance;
                loc1.growthOrder = StringHelper.getString(loc2.growthOrder);
                this._map[loc1.code] = loc1;
            }
            return;
        }

        public init(): void
        {
            var loc1=ConfigManager.instance.getJSONByFileName("t_career.json");
            this.write(loc1);
            return;
        }

        public getInfoByCode(arg1: int): TCareer
        {
            if (arg1 < 0) 
            {
                arg1 = -1 * arg1;
            }
            return this._map[arg1];
        }

        public static get instance(): CareerConfig
        {
            if (CareerConfig._instance == null) 
            {
                CareerConfig._instance = new CareerConfig();
            }
            return CareerConfig._instance;
        }

        /* internal */ /* var */_map: Map<any, any> /* flash.utils.Dictionary */;

        /* internal */ static /* var */_instance: CareerConfig;
    }
